import { useStore } from "vuex";
//    点击播放列表中的歌曲播放
export default function () {
    const store = useStore();
    function clickPlay(data) {

        if (store.state.PlaySong?.presentSong?.id !== data.id) {
            console.log(1);
            store.dispatch("PlaySong/getSongUrl", data);
            store.dispatch("SongLyric/Lyric", data.id);
        } else {

            // 当点击播放的歌曲还是同一首时，重新播放.

            store.state.PlaySong.audioElement.currentTime = 0;
            store.commit("SongLyric/changeLyricProgressTime", 0);
        }
    }
    return {
        clickPlay
    }
}